﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using devtm.Collections;

namespace devtm.AutoMapper
{
    public partial class WindowSelectNamespace : Form
    {
        public WindowSelectNamespace()
        {
            InitializeComponent();
        }

        internal void SetList(TableCollection<string, string> lst)
        {
            comboBox1.DataSource = lst.OrderBy(c => c).ToList();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            this.DialogResult = System.Windows.Forms.DialogResult.OK;
            Close();
        }

        private void button2_Click(object sender, EventArgs e)
        {
            this.DialogResult = System.Windows.Forms.DialogResult.Cancel;
            Close();
        }

        public string SelectedItem { get { return (string)comboBox1.SelectedItem; } }

        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            button1.Enabled = comboBox1.SelectedItem != null;
        }

    }
}
